package com.maimao.model.info;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 积分日志
 *
 * @author MaoLin Wang
 * @date 2021/1/21 4:24 下午
 */
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("mm_integral_action")
public class IntegralAction implements Serializable {

    private static final long serialVersionUID = 7722068150047842131L;

    @TableId(type = IdType.AUTO)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    @TableField("user_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)

    private Long userId;

    private Integer num;

    /**
     * 增加/减少
     */
    private Boolean incr;

    /**
     * 类型 1. 下单使用 - 2.下单商品赠送 + 3. 订单取消返还使用的积分 4.订单取消减少冻结积分
     */
    private Integer type;

    @TableField("related_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long relatedId;

    private Boolean freeze;

    @TableField("create_time")
    private LocalDateTime createTime;

    @Override
    public String toString() {
        return "IntegralAction{" +
                "id=" + id +
                ", userId=" + userId +
                ", num=" + num +
                ", incr=" + incr +
                ", type=" + type +
                ", relatedId=" + relatedId +
                ", freeze=" + freeze +
                ", createTime=" + createTime +
                '}';
    }
}
